package Vista;
import java.awt.event.ActionListener;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerListModel;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaJuez extends javax.swing.JFrame {
	
	private static final String[] TIPO_SEXO = {"Femenino", "Masculino"};
	
	
	private JLabel LblNombre;
	private JComboBox CmbSexo;
	private JLabel LblRegistarjuez;
	private JTextField TxtFechaNac;
	private JLabel JblFechaNac;
	private JButton BttRegistrar;
	private JTextField TxtApellido;
	private JTextField TxtCedula;
	private JTextField TxtNombre;
	private JLabel LblSexo;
	private JLabel LblApellido;
	private JLabel LblCedula;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				VentanaJuez inst = new VentanaJuez();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public VentanaJuez() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				LblNombre = new JLabel();
				getContentPane().add(LblNombre);
				LblNombre.setText("Nombre:");
				LblNombre.setBounds(26, 100, 71, 15);
				LblNombre.setFont(new java.awt.Font("Century Schoolbook L",1,14));
			}
			{
				LblCedula = new JLabel();
				getContentPane().add(LblCedula);
				LblCedula.setText("Cedula:");
				LblCedula.setBounds(26, 67, 71, 15);
				LblCedula.setFont(new java.awt.Font("Century Schoolbook L",1,14));
			}
			{
				LblApellido = new JLabel();
				getContentPane().add(LblApellido);
				LblApellido.setText("Apellido:");
				LblApellido.setBounds(26, 134, 79, 15);
				LblApellido.setFont(new java.awt.Font("Century Schoolbook L",1,14));
			}
			{
				LblSexo = new JLabel();
				getContentPane().add(LblSexo);
				LblSexo.setText("Sexo:");
				LblSexo.setBounds(26, 206, 86, 15);
				LblSexo.setFont(new java.awt.Font("Century Schoolbook L",1,14));
			}
			{
				TxtNombre = new JTextField();
				getContentPane().add(TxtNombre);
				TxtNombre.setBounds(305, 106, 102, 22);
			}
			{
				TxtCedula = new JTextField();
				getContentPane().add(TxtCedula);
				TxtCedula.setBounds(305, 72, 102, 22);
			}
			{
				TxtApellido = new JTextField();
				getContentPane().add(TxtApellido);
				TxtApellido.setBounds(305, 140, 102, 22);
			}
			{
				BttRegistrar = new JButton();
				getContentPane().add(BttRegistrar);
				BttRegistrar.setText("Agregar");
				BttRegistrar.setBounds(146, 249, 125, 26);
				BttRegistrar.setFont(new java.awt.Font("Century Schoolbook L",1,22));
				BttRegistrar.setActionCommand("Registrar");
			}
			{
				JblFechaNac = new JLabel();
				getContentPane().add(JblFechaNac);
				JblFechaNac.setText("Fecha de Nacimiento:");
				JblFechaNac.setBounds(26, 169, 169, 15);
				JblFechaNac.setFont(new java.awt.Font("Century Schoolbook L",1,14));
			}
			{
				TxtFechaNac = new JTextField();
				getContentPane().add(TxtFechaNac);
				TxtFechaNac.setBounds(305, 174, 102, 22);
			}
			{
				LblRegistarjuez = new JLabel();
				getContentPane().add(LblRegistarjuez);
				LblRegistarjuez.setText("Registar Juez");
				LblRegistarjuez.setBounds(117, 17, 188, 35);
				LblRegistarjuez.setFont(new java.awt.Font("Century Schoolbook L",1,24));
			}
			{
			
				
				
				ComboBoxModel CmbSexoModel = 
					new DefaultComboBoxModel(TIPO_SEXO);
							//new String[] { "Item One", "Item Two" });
				CmbSexo = new JComboBox();
				getContentPane().add(CmbSexo);
				CmbSexo.setModel(CmbSexoModel);
				CmbSexo.setBounds(305, 202, 102, 22);
				//CmbSexo.addActionListener(CmbSexoListener);
			}
			pack();
			this.setSize(429, 349);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	//private ActionListener CmbSexoListener= new ActionListener() {
	//}
		
	
	public JButton getRegistarJuez()
	{
		return BttRegistrar;
	}
	public String getApellido(){
		return TxtApellido.getText();
	}
	
	public String getCedula(){
		return TxtCedula.getText();
	}
	
	public String getNombre(){
		return TxtNombre.getText();
	}
	
	public String getFechaNac(){
		return TxtFechaNac.getText();
	
	}
	public String getSexo(){
		return this.CmbSexo.getSelectedItem().toString();
	}
	
	public void agregarListener(ActionListener accion){
		   BttRegistrar.addActionListener(accion);
	}
	
	public void mostrarMensaje(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);
	}

	public void blanquearCampos(){
		
		TxtApellido.setText("");
		TxtCedula.setText("");
		TxtNombre.setText("");
		TxtFechaNac.setText("");
	}
	
	public void setComboSexo (String[] sexos)
	  {
		  ComboBoxModel cmbComboBoxModel = new DefaultComboBoxModel(sexos); 
		  this.CmbSexo.setModel(cmbComboBoxModel);
	  }
	
}



